import tkinter as tk

def clicked():
    print("btn clicked")

# 创建一个将充当主窗口的顶级组件
top = tk.Tk()

# 按钮
btn = tk.Button()
btn['text'] = "按钮"
btn['command'] = clicked
btn.pack()

# Tkinter主事件循环
tk.mainloop()






